package cn.itsource.hbc.org.service.impl;

import cn.itsource.hbc.org.domain.Systemdictionarytype;
import cn.itsource.hbc.org.mapper.SystemdictionarytypeMapper;
import cn.itsource.hbc.org.query.SystemdictionarytypeQuery;
import cn.itsource.hbc.org.service.ISystemdictionarytypeService;
import cn.itsource.utils.PageResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
@Service
@Transactional(readOnly = true,propagation = Propagation.SUPPORTS)
public class SystemdictionarytypeServiceImpl implements ISystemdictionarytypeService {

    @Autowired
    private SystemdictionarytypeMapper systemdictionarytypeMapper;

    @Override
    @Transactional
    public void save(Systemdictionarytype systemdictionarytype) {
        systemdictionarytypeMapper.save(systemdictionarytype);
    }

    @Override
    @Transactional
    public void delete(Long id) {
        systemdictionarytypeMapper.delete(id);
    }

    @Override
    @Transactional
    public void update(Systemdictionarytype systemdictionarytype) {
        systemdictionarytypeMapper.update(systemdictionarytype);
    }

    @Override
    public Systemdictionarytype loadById(Long id) {
        return systemdictionarytypeMapper.loadById(id);
    }

    @Override
    public List<Systemdictionarytype> loadAll() {
        return systemdictionarytypeMapper.loadAll();
    }

    @Override
    @Transactional
    public PageResult<Systemdictionarytype> queryPage(SystemdictionarytypeQuery query) {

        Long total=systemdictionarytypeMapper.count(query);
        if (total==null||total==0){
            return new PageResult<>();
        }
        List<Systemdictionarytype> list=systemdictionarytypeMapper.page(query);

        return new PageResult<>(list,total);
    }

    @Override
    @Transactional
    public void allDelete(Long[] ids) {
        systemdictionarytypeMapper.allDelete(ids);
    }
}
